﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <SolidColorBrush x:Key="HorizontalNormalBorderBrush" Color="#888" />
    <Style x:Key="ScrollBarRepeatButtonUp" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="#caa948" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="ScrollBarRepeatButtonDown" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="#909090" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <!--设置中间滚动条-->
    <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Width" Value="9"/>
        <Setter Property="Height" Value="Auto"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition  Height="9"/>
                                <RowDefinition  Height="*"/>
                                <RowDefinition  Height="9"/>
                            </Grid.RowDefinitions>
                            <Border Grid.Row="0">
                                <Border.Background>
                                    <ImageBrush ImageSource="scroll_bar_thumb_top.png" />
                                </Border.Background>
                            </Border>
                            <Border Grid.Row="1">
                                <Border.Background>
                                    <ImageBrush ImageSource="scroll_bar_thumb_body.png"  TileMode="FlipY"  />
                                </Border.Background>
                            </Border>
                            <Border Grid.Row="2">
                                <Border.Background>
                                    <ImageBrush ImageSource="scroll_bar_thumb_bottom.png" />
                                </Border.Background>
                            </Border>
                        </Grid>
                    </Border>
                    <!--"{TemplateBinding Background}"-->
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
        <Grid>
            <Border Grid.Row="0" />
            <Track x:Name="PART_Track" Grid.Row="0" IsDirectionReversed="True" >
                <Track.DecreaseRepeatButton>
                    <RepeatButton Width="5" Style="{StaticResource ScrollBarRepeatButtonUp}" Command="ScrollBar.PageUpCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{StaticResource ScrollBarThumb}"  BorderBrush="{StaticResource HorizontalNormalBorderBrush}"/>
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton Width="5" Style="{StaticResource ScrollBarRepeatButtonDown}" Command="ScrollBar.PageDownCommand" />
                </Track.IncreaseRepeatButton>
            </Track>
        </Grid>
    </ControlTemplate>
    
    <Style TargetType="{x:Type ScrollViewer}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <ScrollContentPresenter/>
                        <ScrollBar x:Name="PART_VerticalScrollBar" Grid.Column="1" Value="{TemplateBinding VerticalOffset}" Maximum="{TemplateBinding ScrollableHeight}" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Template="{StaticResource VerticalScrollBar}" ViewportSize="{TemplateBinding ViewportHeight}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
    </Style>
</ResourceDictionary>